//
//  XLPageControl.m
//  campus
//
//  Created by xl on 2019/11/14.
//  Copyright © 2019 xl. All rights reserved.
//

#import "XLPageControl.h"

@implementation XLPageControl

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
//重写setCurrentPage方法，可设置圆点大小
- (void)setCurrentPage:(NSInteger)currentPage {
    [super setCurrentPage:currentPage];
    for (NSInteger subViewIndex = 0; subViewIndex < [self.subviews count]; subViewIndex ++) {
        UIView* subview = [self.subviews objectAtIndex:subViewIndex];
        CGSize size;
        if (subViewIndex == currentPage) {
             size.height = 4;
             size.width = 12;
        } else {
            size.height = 4;
            size.width = 8;
        }
        [subview setFrame:CGRectMake(subview.frame.origin.x, subview.frame.origin.y,
        size.width,size.height)];
    }
}
@end
